import config from 'config';
import httpFetch from 'share/httpFetch';
import errorMessage from 'share/errorMessage';
import {deepFullCopy} from "share/common";

export default {
  getAuthorizationHistroyData(params) {
    return new Promise((resolve, reject) => {
        httpFetch.get(config.baseUrl + '/api/user/authorization/findUserAuthorizationList', params)
          .then((res) => {
            resolve(res)
          })
          .catch((err) => {
            errorMessage(err.response);
            reject(err);
          })
      })
  },
  downloadData(id) {
    return new Promise((resolve, reject) => {
      httpFetch.post(config.baseUrl + `/api/user/authorization/uploadAuthorizationPDF?id=${id}` , {}, {}, {responseType: 'arraybuffer'})
        .then((res) => {
          resolve(res)
        })
        .catch((err) => {
          errorMessage(err.response);
          reject(err);
        })
    })
  }
}